export default function(date, showtime = false) {
    const time = new Date(+date);
    const days = time.getDate().toString().padStart(2, '0');
    const month = (time.getMonth() + 1).toString().padStart(2, '0');
    let str = `${time.getFullYear()}-${month}-${days}`;
    if (showtime) {
        const hours = time.getHours().toString().padStart(2, '0');
        const minutes = time.getMinutes().toString().padStart(2, '0');
        const seconds = time.getSeconds().toString().padStart(2, '0');
        str += ` ${hours}:${minutes}:${seconds}`;
    }
    return str;
}